<template>
	<view class="member-list">
		<view class="box" v-for="(item,index) in memberList" :key="index" @click="handleMember(item)">
			<view class="box-vip">
				<image src="@/static/new-vip.png"></image>
			</view>
			<view class="price">
				{{item.money}}{{item.currency_type}}
			</view>
			<view class="box-day">
				全场书免费看{{item.day}}天
			</view>
			<view class="box-footer">
				{{index === 0 ? '85%用户选择' + item.title : item.title }}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			memberList: {
				type: Array,
				default: () => []
			}
		},
		data() {
			return {}
		},
		methods: {
			handleMember(item) {
				// TODO: replace with real purchase logic. For now emit a success event so parent can react.
				this.$emit('recharge-success', item)
				this.$u.toast('模拟购买成功')
			}
		}
	}
</script>

<style lang="less" scoped>
	.member-list {
		width: 100%;
		display: flex;
		justify-content: space-between;
		flex-wrap: wrap;
		margin-top: 32rpx;

		.box:first-child {
			position: relative;
			border: 4rpx solid #FF9D35;
			background: linear-gradient(203deg, #FFF7D1 33%, rgba(255, 255, 255, 0) 130%);

		}

		.box {
			box-sizing: border-box;
			width: calc(100% / 2 - 8rpx);
			position: relative;
			background: #FFFCEC;
			border-radius: 16rpx;
			margin: 20rpx 0;
			text-align: center;
			color: #3D3D3D;
			overflow: hidden;

			.box-vip {
				position: absolute;
				top: -4rpx;
				right: 0;
				width: 70rpx;
				height: 30rpx;

				image {
					width: 100%;
					height: 100%;
				}

			}

			.price {
				padding: 54rpx 0 20rpx 0;
				font-size: 38rpx;
				line-height: 38rpx;
				align-items: center;
				letter-spacing: -0.02em;

				text {
					font-size: 24rpx;
				}
			}

			.box-day {
				font-size: 26rpx;
				min-height: 120rpx;
			}

			.box-footer {
				position: absolute;
				bottom: 0;
				left: 0;
				width: 100%;
				color: #fff;
				height: 50rpx;
				font-size: 20rpx;
				line-height: 50rpx;
				background: #EBC47C;

			}

		}

		.box:first-child .box-footer {
			background: #FF9D35 !important;

		}
	}
</style>